/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-08-20 07:42:35
 * @LastEditors: GGB
 * @LastEditTime: 2021-08-20 14:28:42
 */
import 'package:flutter/material.dart';
import 'package:flutter_data_center/components/animation_text.dart';
import 'package:flutter_data_center/controller/teacher_attendance_controller.dart';
import 'package:flutter_data_center/utills/color_utils.dart';
import 'package:get/get.dart';

class TeacherCountCard extends StatelessWidget {
  const TeacherCountCard({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) => GetBuilder<TeacherAttendanceController>(
        builder: (_controller) => Container(
          height: 84,
          width: double.infinity,
          decoration: BoxDecoration(
            color: gColor("#EBF5F5"),
            borderRadius: BorderRadius.circular(10),
          ),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceAround,
            children: [
              buildItemConnt(_controller.late, "迟到"),
              buildItemConnt(_controller.missing, "缺卡"),
              buildItemConnt(_controller.leave, "早退"),
            ],
          ),
        ),
      );

  Flexible buildItemConnt(int count, String label) {
    return Flexible(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          AnimText(
            number: count,
            style: TextStyle(
              fontSize: 24,
              fontWeight: FontWeight.w500,
            ),
          ),
          SizedBox(height: 10),
          Text(
            label,
            style: TextStyle(fontSize: 14, color: gColor("#08D187")),
          ),
        ],
      ),
    );
  }
}
